package org.xlx.xlx_oa.role_user.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.xlx.xlx_oa.common.ResponseBean;
import org.xlx.xlx_oa.role_user.api.SysControlApi;
import org.xlx.xlx_oa.role_user.domain.vo.SysControlVo;
import org.xlx.xlx_oa.role_user.service.SysControlService;

@RestController
@RequestMapping("/v1/sys-control")
public class SysControlController implements SysControlApi {
    @Autowired
    private SysControlService sysControlService;

    @PostMapping("/save")
    @Override
    public ResponseBean saveEntity(@RequestBody SysControlVo vo) {
        return ResponseBean.successFactory(sysControlService.saveEntity(vo));
    }

    @GetMapping("/remove/{id}")
    @Override
    public ResponseBean removeEntity(@PathVariable(value = "id") Long id) {
        return ResponseBean.successFactory(sysControlService.removeEntity(id));
    }

    @PostMapping("/list")
    @Override
    public ResponseBean getList(@RequestBody SysControlVo vo) {
        return ResponseBean.successFactory(sysControlService.getList(vo));
    }

    @GetMapping("/detail/{id}")
    @Override
    public ResponseBean getDetail(@PathVariable(value = "id") Long id) {
        return ResponseBean.successFactory(sysControlService.getDetail(id));
    }
}

